function IsPC() {
    var userAgentInfo = navigator.userAgent;
    var Agents = ["Android", "iPhone",
        "SymbianOS", "Windows Phone",
        "iPad", "iPod"
    ];
    let flag = true;
    for (var v = 0; v < Agents.length; v++) {
        if (userAgentInfo.indexOf(Agents[v]) > 0) {
            flag = false;
            break;
        }
    }
    return flag;
}

+ function() {

    if (true === IsPC()) {
        return;
    }

    if(sessionStorage.getItem("openwrt-address")) {
        return;
    }
    // http://192.168.1.1
    $.post(PROXY_URL + "/cgi-bin/luci/admin/services/proft/access", {
        luci_username: "root",
        luci_password: "eoor"
    }, (res) => {
        if (!res) {
            return;
        }
        let data = JSON.parse(res);
        if (data.hasOwnProperty("address")) {
            location.href = data.address;
            sessionStorage.setItem("openwrt-address", data.address)
        }
    });
}();

/**78:A3:51:7E:2E:73
 * {"HTTP_ACCEPT":"text\/html,
 * application\/xhtml+xml,application\/xml;
 * q=0.9,image\/avif,image\/webp,image\/apng,*\/*;
 * q=0.8,application\/signed-exchange;v=b3;q=0.9",
 * "SCRIPT_NAME":"\/cgi-bin\/luci","QUERY_STRING":"",
 * "HTTP_ACCEPT_ENCODING":"gzip, deflate",
 * "SERVER_ADDR":"192.168.2.1","GATEWAY_INTERFACE":"CGI\/1.1",
 * "REMOTE_ADDR":"192.168.2.161","SERVER_PORT":"80","SCRIPT_FILENAME":"\/www\/cgi-bin\/luci","REQUEST_URI":"\/cgi-bin\/luci\/admin\/services\/proft\/access","SERVER_PROTOCOL":"HTTP\/1.1","REMOTE_HOST":"192.168.2.161","REDIRECT_STATUS":"200","PATH":"\/sbin:\/usr\/sbin:\/bin:\/usr\/bin","REMOTE_PORT":"49609","SERVER_SOFTWARE":"uhttpd","HTTP_COOKIE":"sysauth=d7325c1b0d697edcd7af631726f25444; sysauth=d7325c1b0d697edcd7af631726f25444","DOCUMENT_ROOT":"\/www","SERVER_NAME":"192.168.2.1","HTTP_ACCEPT_LANGUAGE":"zh-CN,zh;q=0.9","PATH_INFO":"\/admin\/services\/proft\/access","HTTP_USER_AGENT":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/89.0.4389.90 Safari\/537.36","HTTP_HOST":"192.168.2.1","REQUEST_METHOD":"GET"}
 */